package com.rxh.controller;

import com.rxh.pojo.finance.FinanceBusinessReconMoney;
import com.rxh.service.BusinessReconMoneyService;
import com.rxh.util.BusinessReportExcelUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * 
 * @author xuzm
 * @date 20180409
 *
 */
@Controller
@RequestMapping("/businessRecon")
public class BusinessReconMoneyController {
 
	
    @Autowired
    private BusinessReconMoneyService businessReconMoneyService;
    
    @RequestMapping("/getBusinessReconData")
    @ResponseBody
    public Map<String, Object> getBusinessReconData(@RequestBody FinanceBusinessReconMoney businessReconMoney) {
    	
    	Map<String, Object> resultMap = businessReconMoneyService.queryBusinessReconByParam(businessReconMoney);
            	
    	return resultMap;
        
    }
    
    @RequestMapping("/getRecentTradeMerIds")
    @ResponseBody
    public Map<String,Object> getRecentTradeMerIds(@RequestBody FinanceBusinessReconMoney businessReconMoney) {
    	            	
    	return businessReconMoneyService.getRecentTradeMerIds(businessReconMoney);
        
    }
    
    @RequestMapping("/getReconDateList")
    @ResponseBody
    public Map<String, Object> getReconDateList(@RequestBody FinanceBusinessReconMoney businessReconMoney) {
    	
    	Map<String, Object> resultMap = businessReconMoneyService.getReconDateList(businessReconMoney);
            	
    	return resultMap;
        
    }
    
    
    @RequestMapping("/downloadReconData")
    public void downloadReconData(FinanceBusinessReconMoney businessReconMoney,HttpServletRequest request, HttpServletResponse response) {
    	
    	Map<String,Object> resultMap = businessReconMoneyService.getBusinessReportNeededData(businessReconMoney);
    	BusinessReportExcelUtils businessReportExcelUtils = new BusinessReportExcelUtils();
    	businessReportExcelUtils.downloadReconData(businessReconMoney, resultMap, request, response);
    	
            	
    }
    

}
